using System;
using System.Collections.Generic;
using System.Text;
using System.Configuration;
using System.Windows.Forms;

namespace HostMonitor
{
    static class Config
    {
        static private Configuration _conf;

        static Config()
        {
            _conf = ConfigurationManager.OpenExeConfiguration(Application.ExecutablePath);
        }

        static public int Timeout
        {
            get
            {
                return Int32.Parse(_conf.AppSettings.Settings["Timeout"].Value);                
            }
            set
            {
                _conf.AppSettings.Settings["Timeout"].Value = value.ToString();
                _conf.Save(ConfigurationSaveMode.Modified);
            }
        }

        static public int MaxAsyncPings
        {
            get
            {
                return Int32.Parse(_conf.AppSettings.Settings["MaxAsyncPings"].Value);
            }
            set
            {
                _conf.AppSettings.Settings["MaxAsyncPings"].Value = value.ToString();
                _conf.Save(ConfigurationSaveMode.Modified);
            }
        }

        static public int Interval
        {
            get
            {
                return Int32.Parse(_conf.AppSettings.Settings["Interval"].Value);
            }
            set
            {
                _conf.AppSettings.Settings["Interval"].Value = value.ToString();
                _conf.Save(ConfigurationSaveMode.Modified);
            }
        }
    }
}
